/*
 * GUI.java
 *
 * Created on 9 de Dezembro de 2008, 19:29
 */
package ws08;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.MenuElement;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

/**
 *
 * @author  Filipe
 */
public class GUI extends javax.swing.JFrame implements DocumentListener {

    private IndexEngine indexEngine;
    private QueryEngine queryEngine;
    private Files files;
    private JFileChooser open;
    private String defaultPath = "sources";
    private boolean fora = true;
    private boolean sentByRunnable = false;
    private Vector<String> caminhosResultados = new Vector();
    private Vector<String> caminhosMaisAutor = new Vector();
    private Vector<String> caminhosMesmaPackage = new Vector();
    private String idFileSelected = "";
    private Vector<String> idsClassesInFile = new Vector();
    private Vector<String> idsMetodosInFile = new Vector();

    /** Creates new form GUI */
    public GUI() {

        initComponents();
        setIconImage((new javax.swing.ImageIcon(getClass().getResource("/ws08/images/Java24.png"))).getImage());
        this.indexEngine = new IndexEngine(this);
        this.queryEngine = new QueryEngine();
        this.files = new Files();
        open = new JFileChooser();
        open.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        Dimension dim = getToolkit().getScreenSize();
        Rectangle abounds = getBounds();
        setLocation((dim.width - abounds.width) / 2, (dim.height - abounds.height) / 2);
        jTextFieldPesquisa.getDocument().addDocumentListener(this);
        jTextFieldPathIndex.setText(defaultPath);

        painelListaClasses.setVisible(false);
        painelListaMetodos.setVisible(false);

        labelFileSelected.setText("Nenhum ficheiro seleccionado");
        labelAutor.setText("");
        labelDataMod.setText("");
        labelPackage3.setText("");
        labelTamanho.setText("");
        textFieldCaminho.setText("");
        labelNumResults.setText("");


        try {
            if (indexEngine.inicializa()) {
                jLabelMySQL.setText("MySQL Disponível");
                jLabelMySQL.setForeground(Color.green);

            } else {
                jLabelMySQL.setForeground(Color.red);
                JOptionPane.showMessageDialog(this, "A Base de Dados MySQL não está acessível");
                jButtonIndexGo.setEnabled(false);
                jButtonPesquisa.setEnabled(false);
                jTextFieldPesquisa.setEnabled(false);
            }
        } catch (Exception ex) {
            //ex.printStackTrace();
            JOptionPane.showMessageDialog(this, "Ocorreu um Erro ao inicializar o motor de Base de Dados");
            jButtonIndexGo.setEnabled(false);
            jButtonPesquisa.setEnabled(false);
            jTextFieldPesquisa.setEnabled(false);
        }

    }

    private void resetClassesFields() {
        textPaneClasseAutor.setText("");
        textPaneClasseDeprecated.setText("");
        textPaneClasseDescricao.setText("");
        textPaneClasseNome.setText("");
        textPaneClassePackage.setText("");
        textPaneClasseSince.setText("");
        textPaneClasseVerTb.setText("");
        textPaneClasseVersao.setText("");
        textPaneClassesExcep.setText("");
    }

    private void resetDetalhes() {
        labelFileSelected.setText("Nenhum ficheiro seleccionado");
        labelAutor.setText("");
        labelDataMod.setText("");
        labelPackage3.setText("");
        labelTamanho.setText("");
        textFieldCaminho.setText("");
    }

    private void resetMethodsFields() {
        textPaneMetDeprecated.setText("");
        textPaneMetDescricao.setText("");
        textPaneMetExcep.setText("");
        textPaneMetNome.setText("");
        textPaneMetParam.setText("");
        textPaneMetReturn.setText("");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItemNomeFich = new javax.swing.JMenuItem();
        jMenuItemNomeClasse = new javax.swing.JMenuItem();
        jMenuItemMetodo = new javax.swing.JMenuItem();
        jMenuItemAutor = new javax.swing.JMenuItem();
        jMenuItemVar = new javax.swing.JMenuItem();
        jMenuItemData = new javax.swing.JMenuItem();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        Tab1 = new javax.swing.JPanel();
        painelPrincipal = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabelPesquisa = new javax.swing.JLabel();
        jTextFieldPesquisa = new javax.swing.JTextField();
        jButtonPesquisa = new javax.swing.JButton();
        labelNumResults = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        listaResultados = new javax.swing.JList();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        listaMesmaPackage = new javax.swing.JList();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        listaMaisDoAutor = new javax.swing.JList();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        labelFileSelected = new javax.swing.JLabel();
        butVerMetodos = new javax.swing.JButton();
        butVerClasses = new javax.swing.JButton();
        textFieldCaminho = new javax.swing.JTextField();
        labelTamanho = new javax.swing.JLabel();
        labelDataMod = new javax.swing.JLabel();
        labelAutor = new javax.swing.JLabel();
        labelPackage3 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        painelListaMetodos = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        listaMetodos = new javax.swing.JList();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        textPaneMetDescricao = new javax.swing.JTextPane();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        textPaneMetParam = new javax.swing.JTextPane();
        jScrollPane7 = new javax.swing.JScrollPane();
        textPaneMetReturn = new javax.swing.JTextPane();
        jScrollPane8 = new javax.swing.JScrollPane();
        textPaneMetExcep = new javax.swing.JTextPane();
        jScrollPane9 = new javax.swing.JScrollPane();
        textPaneMetDeprecated = new javax.swing.JTextPane();
        jScrollPane10 = new javax.swing.JScrollPane();
        textPaneMetNome = new javax.swing.JTextPane();
        butListaMetodosVoltar = new javax.swing.JButton();
        labelTituloPainelMetodos = new javax.swing.JLabel();
        labelTituloPainelMetodos1 = new javax.swing.JLabel();
        painelListaClasses = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        listaClasses = new javax.swing.JList();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane12 = new javax.swing.JScrollPane();
        textPaneClasseDescricao = new javax.swing.JTextPane();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane13 = new javax.swing.JScrollPane();
        textPaneClasseAutor = new javax.swing.JTextPane();
        jScrollPane14 = new javax.swing.JScrollPane();
        textPaneClassePackage = new javax.swing.JTextPane();
        jScrollPane15 = new javax.swing.JScrollPane();
        textPaneClassesExcep = new javax.swing.JTextPane();
        jScrollPane16 = new javax.swing.JScrollPane();
        textPaneClasseDeprecated = new javax.swing.JTextPane();
        jScrollPane17 = new javax.swing.JScrollPane();
        textPaneClasseNome = new javax.swing.JTextPane();
        Versão = new javax.swing.JLabel();
        jScrollPane18 = new javax.swing.JScrollPane();
        textPaneClasseVersao = new javax.swing.JTextPane();
        Versão1 = new javax.swing.JLabel();
        jScrollPane19 = new javax.swing.JScrollPane();
        textPaneClasseSince = new javax.swing.JTextPane();
        Versão2 = new javax.swing.JLabel();
        jScrollPane20 = new javax.swing.JScrollPane();
        textPaneClasseVerTb = new javax.swing.JTextPane();
        butListaMetodosVoltar1 = new javax.swing.JButton();
        labelTituloPainelClasses = new javax.swing.JLabel();
        labelTituloPainelMetodos3 = new javax.swing.JLabel();
        Tab2 = new javax.swing.JPanel();
        jLabelMySQL = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldPathIndex = new javax.swing.JTextField();
        jButtonIndexGo = new javax.swing.JButton();
        jLabelStatusIndex = new javax.swing.JLabel();
        jButtonIndexProcura = new javax.swing.JButton();
        butAbortar = new javax.swing.JButton();
        labelPercentagem = new javax.swing.JLabel();
        jScrollPane21 = new javax.swing.JScrollPane();
        textOutIndex = new javax.swing.JTextArea();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        jPopupMenu1.setInvoker(jTextFieldPesquisa);
        jPopupMenu1.setLightWeightPopupEnabled(false);
        jPopupMenu1.addMenuKeyListener(new javax.swing.event.MenuKeyListener() {
            public void menuKeyPressed(javax.swing.event.MenuKeyEvent evt) {
                jPopupMenu1MenuKeyPressed(evt);
            }
            public void menuKeyReleased(javax.swing.event.MenuKeyEvent evt) {
            }
            public void menuKeyTyped(javax.swing.event.MenuKeyEvent evt) {
            }
        });

        jMenuItemNomeFich.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemNomeFich.setText("Ficheiro");
        jMenuItemNomeFich.setIconTextGap(0);
        jMenuItemNomeFich.setSelected(true);
        jMenuItemNomeFich.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemNomeFichStateChanged(evt);
            }
        });
        jMenuItemNomeFich.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemNomeFichActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemNomeFich);

        jMenuItemNomeClasse.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemNomeClasse.setText("Classe");
        jMenuItemNomeClasse.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemNomeClasseStateChanged(evt);
            }
        });
        jMenuItemNomeClasse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemNomeClasseActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemNomeClasse);

        jMenuItemMetodo.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemMetodo.setText("Método");
        jMenuItemMetodo.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemMetodoStateChanged(evt);
            }
        });
        jMenuItemMetodo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemMetodoActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemMetodo);

        jMenuItemAutor.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemAutor.setText("Autor");
        jMenuItemAutor.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemAutorStateChanged(evt);
            }
        });
        jMenuItemAutor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAutorActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemAutor);

        jMenuItemVar.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemVar.setText("Variável");
        jMenuItemVar.setFocusPainted(true);
        jMenuItemVar.setFocusable(true);
        jMenuItemVar.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemVarStateChanged(evt);
            }
        });
        jMenuItemVar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemVarActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemVar);

        jMenuItemData.setFont(new java.awt.Font("Calibri", 1, 12));
        jMenuItemData.setText("Data");
        jMenuItemData.setFocusPainted(true);
        jMenuItemData.setFocusable(true);
        jMenuItemData.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jMenuItemDataStateChanged(evt);
            }
        });
        jMenuItemData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDataActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItemData);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Intelligent Javadoc Search Tool");
        setBounds(new java.awt.Rectangle(0, 0, 800, 600));
        setIconImages(null);
        setMinimumSize(new java.awt.Dimension(800, 600));
        setResizable(false);

        jTabbedPane1.setFont(new java.awt.Font("Tahoma", 0, 14));
        jTabbedPane1.setOpaque(true);
        jTabbedPane1.setVerifyInputWhenFocusTarget(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Procura", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 51, 255))); // NOI18N
        jPanel1.setMaximumSize(new java.awt.Dimension(250, 100));
        jPanel1.setMinimumSize(new java.awt.Dimension(250, 100));
        jPanel1.setPreferredSize(new java.awt.Dimension(250, 100));

        jLabelPesquisa.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabelPesquisa.setForeground(new java.awt.Color(102, 102, 102));
        jLabelPesquisa.setText("Insira o termo a pesquisar");
        jLabelPesquisa.setToolTipText("texto");

        jTextFieldPesquisa.setFont(new java.awt.Font("Verdana", 0, 12));
        jTextFieldPesquisa.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jTextFieldPesquisa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextFieldPesquisaKeyPressed(evt);
            }
        });

        jButtonPesquisa.setText("Pesquisar");
        jButtonPesquisa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesquisaActionPerformed(evt);
            }
        });

        labelNumResults.setBackground(new java.awt.Color(153, 153, 153));
        labelNumResults.setFont(new java.awt.Font("Tahoma", 0, 13));
        labelNumResults.setForeground(new java.awt.Color(255, 51, 51));
        labelNumResults.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        labelNumResults.setText("resultados");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNumResults, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jLabelPesquisa, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jTextFieldPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButtonPesquisa))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabelPesquisa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelNumResults)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Resultados", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 51, 255))); // NOI18N

        listaResultados.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listaResultados.setToolTipText("Faça duplo clique para visualizar o código fonte");
        listaResultados.setRequestFocusEnabled(false);
        listaResultados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaResultadosMouseClicked(evt);
            }
        });
        listaResultados.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listaResultadosValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(listaResultados);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Na mesma Package", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 51, 255))); // NOI18N

        listaMesmaPackage.setToolTipText("Faça duplo clique para visualizar o código fonte");
        listaMesmaPackage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaMesmaPackageMouseClicked(evt);
            }
        });
        listaMesmaPackage.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listaMesmaPackageValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(listaMesmaPackage);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Mais deste autor", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 51, 255))); // NOI18N

        listaMaisDoAutor.setToolTipText("Faça duplo clique para visualizar o código fonte");
        listaMaisDoAutor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaMaisDoAutorMouseClicked(evt);
            }
        });
        listaMaisDoAutor.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listaMaisDoAutorValueChanged(evt);
            }
        });
        jScrollPane3.setViewportView(listaMaisDoAutor);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalhes", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 51, 255))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setForeground(new java.awt.Color(0, 102, 153));
        jLabel1.setText("Localização:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel3.setForeground(new java.awt.Color(0, 102, 153));
        jLabel3.setText("Tamanho:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel5.setForeground(new java.awt.Color(0, 102, 153));
        jLabel5.setText("Data de Modificação:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel6.setForeground(new java.awt.Color(0, 102, 153));
        jLabel6.setText("Autor(es):");

        labelFileSelected.setFont(new java.awt.Font("Tahoma", 1, 14));
        labelFileSelected.setForeground(new java.awt.Color(102, 102, 255));
        labelFileSelected.setText("Ficheiro.java");

        butVerMetodos.setText("Ver Métodos");
        butVerMetodos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butVerMetodosActionPerformed(evt);
            }
        });

        butVerClasses.setText("Ver Classes");
        butVerClasses.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butVerClassesActionPerformed(evt);
            }
        });

        textFieldCaminho.setBackground(java.awt.SystemColor.control);
        textFieldCaminho.setEditable(false);
        textFieldCaminho.setText("C:\\");

            labelTamanho.setFont(new java.awt.Font("Tahoma", 0, 12));
            labelTamanho.setText("120KB");

            labelDataMod.setFont(new java.awt.Font("Tahoma", 0, 12));
            labelDataMod.setText("12/12/2008 16:45");

            labelAutor.setFont(new java.awt.Font("Tahoma", 0, 12));
            labelAutor.setText("Sabino Rui, Telmo Corridas, Campião Filipe");

            labelPackage3.setFont(new java.awt.Font("Tahoma", 0, 12));
            labelPackage3.setText("PackageName");

            jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel8.setForeground(new java.awt.Color(0, 102, 153));
            jLabel8.setText("Package:");

            javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
            jPanel5.setLayout(jPanel5Layout);
            jPanel5Layout.setHorizontalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(labelFileSelected, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(butVerClasses)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(butVerMetodos))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel8)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelPackage3, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelTamanho, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(textFieldCaminho, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelDataMod, javax.swing.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelAutor, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)))
                    .addContainerGap())
            );
            jPanel5Layout.setVerticalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addComponent(labelFileSelected)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel1)
                        .addComponent(textFieldCaminho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(labelTamanho))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(labelDataMod))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel6)
                        .addComponent(labelAutor))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(labelPackage3))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(butVerClasses)
                        .addComponent(butVerMetodos))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );

            jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ws08/images/Java64.png"))); // NOI18N

            javax.swing.GroupLayout painelPrincipalLayout = new javax.swing.GroupLayout(painelPrincipal);
            painelPrincipal.setLayout(painelPrincipalLayout);
            painelPrincipalLayout.setHorizontalGroup(
                painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(painelPrincipalLayout.createSequentialGroup()
                    .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(painelPrincipalLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(painelPrincipalLayout.createSequentialGroup()
                                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(painelPrincipalLayout.createSequentialGroup()
                            .addGap(225, 225, 225)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel4)))
                    .addContainerGap())
            );
            painelPrincipalLayout.setVerticalGroup(
                painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(painelPrincipalLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(painelPrincipalLayout.createSequentialGroup()
                            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap())
            );

            painelListaMetodos.setEnabled(false);

            jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Métodos", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 102, 255))); // NOI18N

            listaMetodos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
                public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                    listaMetodosValueChanged(evt);
                }
            });
            jScrollPane4.setViewportView(listaMetodos);

            javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
            jPanel6.setLayout(jPanel6Layout);
            jPanel6Layout.setHorizontalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE)
            );
            jPanel6Layout.setVerticalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
            );

            jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalhes", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 102, 255))); // NOI18N
            jPanel7.setMaximumSize(new java.awt.Dimension(500, 470));
            jPanel7.setMinimumSize(new java.awt.Dimension(500, 470));
            jPanel7.setPreferredSize(new java.awt.Dimension(500, 470));

            textPaneMetDescricao.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane5.setViewportView(textPaneMetDescricao);

            jLabel9.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel9.setForeground(new java.awt.Color(0, 153, 255));
            jLabel9.setText("Nome");

            jLabel10.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel10.setForeground(new java.awt.Color(0, 153, 255));
            jLabel10.setText("Excepções");

            jLabel11.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel11.setForeground(new java.awt.Color(0, 153, 255));
            jLabel11.setText("Descrição");

            jLabel12.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel12.setForeground(new java.awt.Color(0, 153, 255));
            jLabel12.setText("Parâmetros de Entrada");

            jLabel13.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel13.setForeground(new java.awt.Color(0, 153, 255));
            jLabel13.setText("Valor de retorno");

            jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel14.setForeground(new java.awt.Color(0, 153, 255));
            jLabel14.setText("Deprecated");

            textPaneMetParam.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane6.setViewportView(textPaneMetParam);

            textPaneMetReturn.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane7.setViewportView(textPaneMetReturn);

            textPaneMetExcep.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane8.setViewportView(textPaneMetExcep);

            textPaneMetDeprecated.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane9.setViewportView(textPaneMetDeprecated);

            textPaneMetNome.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane10.setViewportView(textPaneMetNome);

            javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
            jPanel7.setLayout(jPanel7Layout);
            jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel9)
                            .addComponent(jLabel13)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap())
            );
            jPanel7Layout.setVerticalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel9)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel12)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel13)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel10)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel14)
                    .addGap(5, 5, 5)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel11)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                    .addContainerGap())
            );

            butListaMetodosVoltar.setFont(new java.awt.Font("Tahoma", 0, 14));
            butListaMetodosVoltar.setText("Voltar");
            butListaMetodosVoltar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    butListaMetodosVoltarActionPerformed(evt);
                }
            });

            labelTituloPainelMetodos.setFont(new java.awt.Font("Tahoma", 0, 18));
            labelTituloPainelMetodos.setForeground(new java.awt.Color(0, 51, 255));
            labelTituloPainelMetodos.setText("File.java");

            labelTituloPainelMetodos1.setFont(new java.awt.Font("Tahoma", 0, 18));
            labelTituloPainelMetodos1.setForeground(new java.awt.Color(0, 51, 255));
            labelTituloPainelMetodos1.setText("Métodos em");

            javax.swing.GroupLayout painelListaMetodosLayout = new javax.swing.GroupLayout(painelListaMetodos);
            painelListaMetodos.setLayout(painelListaMetodosLayout);
            painelListaMetodosLayout.setHorizontalGroup(
                painelListaMetodosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(painelListaMetodosLayout.createSequentialGroup()
                    .addGroup(painelListaMetodosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelListaMetodosLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(painelListaMetodosLayout.createSequentialGroup()
                            .addGap(34, 34, 34)
                            .addComponent(labelTituloPainelMetodos1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelTituloPainelMetodos, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 271, Short.MAX_VALUE)
                            .addComponent(butListaMetodosVoltar)))
                    .addContainerGap())
            );
            painelListaMetodosLayout.setVerticalGroup(
                painelListaMetodosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelListaMetodosLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(painelListaMetodosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelTituloPainelMetodos1)
                        .addComponent(butListaMetodosVoltar)
                        .addComponent(labelTituloPainelMetodos))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(painelListaMetodosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel7, 0, 487, Short.MAX_VALUE))
                    .addContainerGap())
            );

            painelListaClasses.setEnabled(false);

            jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalhes", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 102, 255))); // NOI18N

            listaClasses.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
                public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                    listaClassesValueChanged(evt);
                }
            });
            jScrollPane11.setViewportView(listaClasses);

            javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
            jPanel8.setLayout(jPanel8Layout);
            jPanel8Layout.setHorizontalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
            );
            jPanel8Layout.setVerticalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
            );

            jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalhes", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 102, 255))); // NOI18N
            jPanel9.setMinimumSize(new java.awt.Dimension(400, 600));

            textPaneClasseDescricao.setEditable(false);
            textPaneClasseDescricao.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane12.setViewportView(textPaneClasseDescricao);

            jLabel15.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel15.setForeground(new java.awt.Color(0, 153, 255));
            jLabel15.setText("Nome");

            jLabel16.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel16.setForeground(new java.awt.Color(0, 153, 255));
            jLabel16.setText("Excepções");

            jLabel17.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel17.setForeground(new java.awt.Color(0, 153, 255));
            jLabel17.setText("Descrição");

            jLabel18.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel18.setForeground(new java.awt.Color(0, 153, 255));
            jLabel18.setText("Autor");

            jLabel19.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel19.setForeground(new java.awt.Color(0, 153, 255));
            jLabel19.setText("Package");

            jLabel20.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel20.setForeground(new java.awt.Color(0, 153, 255));
            jLabel20.setText("Deprecated");

            textPaneClasseAutor.setEditable(false);
            textPaneClasseAutor.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane13.setViewportView(textPaneClasseAutor);

            textPaneClassePackage.setEditable(false);
            textPaneClassePackage.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane14.setViewportView(textPaneClassePackage);

            textPaneClassesExcep.setEditable(false);
            textPaneClassesExcep.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane15.setViewportView(textPaneClassesExcep);

            textPaneClasseDeprecated.setEditable(false);
            textPaneClasseDeprecated.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane16.setViewportView(textPaneClasseDeprecated);

            textPaneClasseNome.setEditable(false);
            textPaneClasseNome.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane17.setViewportView(textPaneClasseNome);

            Versão.setFont(new java.awt.Font("Tahoma", 1, 12));
            Versão.setForeground(new java.awt.Color(0, 153, 255));
            Versão.setText("Versão");

            textPaneClasseVersao.setEditable(false);
            textPaneClasseVersao.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane18.setViewportView(textPaneClasseVersao);

            Versão1.setFont(new java.awt.Font("Tahoma", 1, 12));
            Versão1.setForeground(new java.awt.Color(0, 153, 255));
            Versão1.setText("Desde");

            textPaneClasseSince.setEditable(false);
            textPaneClasseSince.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane19.setViewportView(textPaneClasseSince);

            Versão2.setFont(new java.awt.Font("Tahoma", 1, 12));
            Versão2.setForeground(new java.awt.Color(0, 153, 255));
            Versão2.setText("Ver também");

            textPaneClasseVerTb.setEditable(false);
            textPaneClasseVerTb.setFont(new java.awt.Font("Courier New", 0, 11));
            jScrollPane20.setViewportView(textPaneClasseVerTb);

            javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
            jPanel9.setLayout(jPanel9Layout);
            jPanel9Layout.setHorizontalGroup(
                jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
                        .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
                        .addComponent(jScrollPane15, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
                        .addComponent(jLabel15)
                        .addComponent(jLabel19)
                        .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel18)
                        .addComponent(jLabel16)
                        .addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel17)
                        .addGroup(jPanel9Layout.createSequentialGroup()
                            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel20))
                            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addGap(54, 54, 54)
                                    .addComponent(Versão)))
                            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addGap(24, 24, 24)
                                    .addComponent(Versão1))
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jScrollPane19, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addComponent(Versão2)
                        .addComponent(jScrollPane20, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE))
                    .addContainerGap())
            );
            jPanel9Layout.setVerticalGroup(
                jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel15)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel18)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel19)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel16)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                .addGap(21, 21, 21)
                                .addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel20)
                                    .addComponent(Versão))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel9Layout.createSequentialGroup()
                            .addComponent(Versão1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(Versão2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(3, 3, 3)
                    .addComponent(jLabel17)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)
                    .addContainerGap())
            );

            butListaMetodosVoltar1.setFont(new java.awt.Font("Tahoma", 0, 14));
            butListaMetodosVoltar1.setText("Voltar");
            butListaMetodosVoltar1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    butListaMetodosVoltar1ActionPerformed(evt);
                }
            });

            labelTituloPainelClasses.setFont(new java.awt.Font("Tahoma", 0, 18));
            labelTituloPainelClasses.setForeground(new java.awt.Color(0, 51, 255));
            labelTituloPainelClasses.setText("File.java");

            labelTituloPainelMetodos3.setFont(new java.awt.Font("Tahoma", 0, 18));
            labelTituloPainelMetodos3.setForeground(new java.awt.Color(0, 51, 255));
            labelTituloPainelMetodos3.setText("Classes em");

            javax.swing.GroupLayout painelListaClassesLayout = new javax.swing.GroupLayout(painelListaClasses);
            painelListaClasses.setLayout(painelListaClassesLayout);
            painelListaClassesLayout.setHorizontalGroup(
                painelListaClassesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(painelListaClassesLayout.createSequentialGroup()
                    .addGroup(painelListaClassesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(painelListaClassesLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(painelListaClassesLayout.createSequentialGroup()
                            .addGap(34, 34, 34)
                            .addComponent(labelTituloPainelMetodos3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelTituloPainelClasses, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 252, Short.MAX_VALUE)
                            .addComponent(butListaMetodosVoltar1)))
                    .addContainerGap())
            );
            painelListaClassesLayout.setVerticalGroup(
                painelListaClassesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelListaClassesLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(painelListaClassesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelTituloPainelMetodos3)
                        .addComponent(butListaMetodosVoltar1)
                        .addComponent(labelTituloPainelClasses))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(painelListaClassesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 487, Short.MAX_VALUE))
                    .addContainerGap())
            );

            javax.swing.GroupLayout Tab1Layout = new javax.swing.GroupLayout(Tab1);
            Tab1.setLayout(Tab1Layout);
            Tab1Layout.setHorizontalGroup(
                Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(painelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 805, Short.MAX_VALUE)
                .addGroup(Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Tab1Layout.createSequentialGroup()
                        .addComponent(painelListaMetodos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Tab1Layout.createSequentialGroup()
                        .addComponent(painelListaClasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            );
            Tab1Layout.setVerticalGroup(
                Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(painelPrincipal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
                .addGroup(Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painelListaMetodos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(Tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Tab1Layout.createSequentialGroup()
                        .addComponent(painelListaClasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            );

            jTabbedPane1.addTab("Procura", new javax.swing.ImageIcon(getClass().getResource("/ws08/images/Search24.png")), Tab1); // NOI18N

            jLabelMySQL.setFont(new java.awt.Font("Tahoma", 1, 11));
            jLabelMySQL.setText("MySQL Indisponível");

            jPanel10.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

            jLabel2.setText("Directoria a indexar:");

            jTextFieldPathIndex.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jTextFieldPathIndexActionPerformed(evt);
                }
            });

            jButtonIndexGo.setText("Indexar");
            jButtonIndexGo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonIndexGoActionPerformed(evt);
                }
            });

            jLabelStatusIndex.setText("Pronto");

            jButtonIndexProcura.setText("Procurar");
            jButtonIndexProcura.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonIndexProcuraActionPerformed(evt);
                }
            });

            butAbortar.setText("Abortar");
            butAbortar.setEnabled(false);
            butAbortar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    butAbortarActionPerformed(evt);
                }
            });

            labelPercentagem.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
            labelPercentagem.setText("Status:");

            textOutIndex.setColumns(20);
            textOutIndex.setEditable(false);
            textOutIndex.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
            textOutIndex.setRows(5);
            textOutIndex.setWrapStyleWord(true);
            textOutIndex.setAutoscrolls(false);
            jScrollPane21.setViewportView(textOutIndex);

            javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
            jPanel10.setLayout(jPanel10Layout);
            jPanel10Layout.setHorizontalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane21, javax.swing.GroupLayout.DEFAULT_SIZE, 622, Short.MAX_VALUE)
                        .addComponent(jLabel2)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldPathIndex, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addComponent(jButtonIndexGo)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabelStatusIndex)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButtonIndexProcura))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(butAbortar)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(labelPercentagem)))
                    .addContainerGap())
            );
            jPanel10Layout.setVerticalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldPathIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButtonIndexProcura))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButtonIndexGo)
                        .addComponent(jLabelStatusIndex))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(butAbortar)
                        .addComponent(labelPercentagem))
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane21, javax.swing.GroupLayout.DEFAULT_SIZE, 296, Short.MAX_VALUE)
                    .addContainerGap())
            );

            javax.swing.GroupLayout Tab2Layout = new javax.swing.GroupLayout(Tab2);
            Tab2.setLayout(Tab2Layout);
            Tab2Layout.setHorizontalGroup(
                Tab2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(Tab2Layout.createSequentialGroup()
                    .addContainerGap(74, Short.MAX_VALUE)
                    .addGroup(Tab2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Tab2Layout.createSequentialGroup()
                            .addComponent(jLabelMySQL)
                            .addContainerGap())
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Tab2Layout.createSequentialGroup()
                            .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(73, 73, 73))))
            );
            Tab2Layout.setVerticalGroup(
                Tab2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(Tab2Layout.createSequentialGroup()
                    .addGap(9, 9, 9)
                    .addComponent(jLabelMySQL)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(69, Short.MAX_VALUE))
            );

            jTabbedPane1.addTab("Indexação", new javax.swing.ImageIcon(getClass().getResource("/ws08/images/Maintenance24.png")), Tab2); // NOI18N

            jMenu1.setText("Ficheiro");

            jMenuItem1.setText("Sair");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem1ActionPerformed(evt);
                }
            });
            jMenu1.add(jMenuItem1);

            jMenuBar1.add(jMenu1);

            jMenu2.setText("Ajuda");

            jMenuItem2.setText("Acerca");
            jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem2ActionPerformed(evt);
                }
            });
            jMenu2.add(jMenuItem2);

            jMenuBar1.add(jMenu2);

            setJMenuBar(jMenuBar1);

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 800, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 579, javax.swing.GroupLayout.PREFERRED_SIZE)
            );

            pack();
        }// </editor-fold>//GEN-END:initComponents

    private void mudaTextTipoPesquisa(JMenuItem item) {
        if (fora) {
            sentByRunnable = true;
            String textoActual = jTextFieldPesquisa.getText();
            final StringBuilder textoFinal = new StringBuilder("?" + item.getText() + " ");
            String[] split = textoActual.split(" ");
            if (split.length > 1) {
                for (int i = 1; i < split.length; i++) {
                    textoFinal.append(split[i] + " ");
                }
            }

            try {
                EventQueue.invokeLater(new Runnable() {

                    public void run() {
                        jTextFieldPesquisa.setText(textoFinal.toString());

                    }
                });
            } catch (Exception e) {
                System.out.println("NAO PODES!!!!!!!!!");
            }
            fora = false;
        } else {
            fora = true;
        }
    }

    private void pesquisaMaisDesteAutor(String text) {
        if (text.length() != 0) {
            trataResultadosPesquisa(1, queryEngine.interpretaInput(1, text));
        } else {
            refreshListaMaisAutor(new Vector());
        }
    }

    private void pesquisaMesmaPackage(String text) {
        if (text.length() != 0) {
            trataResultadosPesquisa(2, queryEngine.interpretaInput(2, text));
        } else {
            refreshListaMesmaPackage(new Vector());
        }

    }

    private void pesquisaClassesInFile(String text) {
        if (text.length() != 0) {
            trataResultadosPesquisa(3, queryEngine.interpretaInput(3, text));
        } else {
            refreshListaClasses(new Vector());
        }
    }

    private void pesquisaMetodosInFile(String idFileSelected) {
        if (idFileSelected.length() != 0) {
            trataResultadosPesquisa(4, queryEngine.interpretaInput(4, idFileSelected));
        } else {
            refreshListaMetodos(new Vector());
        }
    }

    private void refreshListaClasses(Vector<String> results) {
        listaClasses.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listaClasses.setListData(results);
    }

    private void refreshListaMetodos(Vector results) {
        listaMetodos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listaMetodos.setListData(results);
    }

    private void refreshListaResultados(Vector<String> results) {
        listaResultados.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listaResultados.setListData(results);
    }

    private void refreshListaMaisAutor(Vector<String> results) {
        listaMaisDoAutor.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listaMaisDoAutor.setListData(results);
    }

    private void refreshListaMesmaPackage(Vector<String> results) {
        listaMesmaPackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listaMesmaPackage.setListData(results);
    }
private void jButtonIndexProcuraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonIndexProcuraActionPerformed

    int op = open.showOpenDialog(this);

    if (op == JFileChooser.APPROVE_OPTION) {
        File arq = open.getSelectedFile();
        String pathIndexar = arq.toString();
        jTextFieldPathIndex.setText(pathIndexar);

    }
}//GEN-LAST:event_jButtonIndexProcuraActionPerformed

// Listen for changes in the text
    public void insertUpdate(DocumentEvent e) {

        String text = jTextFieldPesquisa.getText();
        if (text.length() > 0) {

            if (text.charAt(0) == '?' && !(text.contains(" ") && text.charAt(text.length() - 1) != ' ')) {
                if (text.split(" ").length < 2) {
                    jPopupMenu1.setLocation(new Point(jTextFieldPesquisa.getLocationOnScreen().x, jTextFieldPesquisa.getLocationOnScreen().y + jTextFieldPesquisa.getHeight()));
                    jPopupMenu1.setVisible(true);
                    jTextFieldPesquisa.requestFocusInWindow();
                }
            } else {
//                jPopupMenu1.setVisible(false);
            }
        }
    }

    public void removeUpdate(DocumentEvent e) {

        String text = jTextFieldPesquisa.getText();
        if (text.length() > 0) {
            sentByRunnable = false;
            if (text.charAt(0) == '?' && !(text.contains(" ") && text.charAt(text.length() - 1) != ' ')) {
                if (text.split(" ").length < 2) {
                    //trata tipo pesquisa mostra sugestões :D
                    jPopupMenu1.setLocation(new Point(jTextFieldPesquisa.getLocationOnScreen().x, jTextFieldPesquisa.getLocationOnScreen().y + jTextFieldPesquisa.getHeight()));
                    jPopupMenu1.setVisible(true);
                    jTextFieldPesquisa.requestFocusInWindow();
                }
            } else {
                jPopupMenu1.setVisible(false);
            }
        } else {
            if (!sentByRunnable) {
                jPopupMenu1.setVisible(false);
            }
        }
    }

    public void changedUpdate(DocumentEvent e) {
        throw new UnsupportedOperationException("Alterou");
    }

private void jTextFieldPathIndexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPathIndexActionPerformed
}//GEN-LAST:event_jTextFieldPathIndexActionPerformed

private void jButtonIndexGoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonIndexGoActionPerformed
    final String path = jTextFieldPathIndex.getText();
    if (path.length() == 0) {
        JOptionPane.showMessageDialog(this, "Tem que inserir um caminho");
    } else {
        jLabelStatusIndex.setText("Indexando...");
        textOutIndex.setText("Preparando para indexar");
        jButtonIndexGo.setEnabled(false);
        butAbortar.setEnabled(true);
        indexEngine.indexando = true;
        Runnable thread = new Runnable() {

            public void run() {
                try {
                    if (indexEngine.indexa(path)) {
                        jLabelStatusIndex.setText("Pronto");
                        JOptionPane.showMessageDialog(rootPane, "Indexação concluída. " + indexEngine.getCountFilesAdded() + " ficheiros indexados.");
                        butAbortar.setEnabled(false);
                    } else {
                        jLabelStatusIndex.setText("Pronto");
                        JOptionPane.showMessageDialog(rootPane, "Indexação interrompida.");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    jLabelStatusIndex.setText("Indisponível");
                    JOptionPane.showMessageDialog(rootPane, "Ocorreu um erro ao indexar");
                }
                jButtonIndexGo.setEnabled(true);
            }
        };
//        Runnable thread2 = new Runnable() {
//
//            public void run() {
//                while (indexEngine.indexando) {
//                    labelPercentagem.setText("Status: " + indexEngine.getCurrentPercentage() + "%");
//                    try {
//                        Thread.sleep(500);
//                    } catch (InterruptedException ex) {
//                        ex.printStackTrace();
//                    }
//                }
//                labelPercentagem.setText("Status: 100%");
//                System.out.println("thread dead");
//            }
//        };
        new Thread(thread).start();
//        new Thread(thread2).start();
    }
}//GEN-LAST:event_jButtonIndexGoActionPerformed

private void listaResultadosValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listaResultadosValueChanged
    Vector<String> tmp;
    DecimalFormat df = new DecimalFormat("0.0");
    if (evt.getValueIsAdjusting() == false) {
        if (listaResultados.getSelectedValue() != null) {

            String str = (String) listaResultados.getSelectedValue();
            int index = listaResultados.getSelectedIndex();
            idFileSelected = caminhosResultados.get(listaResultados.getSelectedIndex()).split("%")[1];
            tmp = queryEngine.getFileInfos(caminhosResultados.get(index).split("%")[1], 0);

            StringTokenizer tokenizer = new StringTokenizer(str);
            while (tokenizer.hasMoreTokens()) {
                str = tokenizer.nextToken();
            }
            String path = caminhosResultados.get(index).split("%")[0];
            textFieldCaminho.setText(path);
            labelFileSelected.setText(str);
            labelTamanho.setText("");
            labelDataMod.setText("");
            labelPackage3.setText("");
            labelAutor.setText("");
            for (String string : tmp) {
                if (!labelTamanho.getText().contains(string.split("&")[0])) {
                    labelTamanho.setText(df.format(Double.parseDouble(string.split("&")[0]) / 1024) + " KB");
                }
                if (!labelDataMod.getText().contains(string.split("&")[1])) {
                    labelDataMod.setText(string.split("&")[1]);
                }
                if (!labelPackage3.getText().contains(string.split("&")[3])) {
                    labelPackage3.setText(string.split("&")[3]);
                }
                if (!labelAutor.getText().contains(string.split("&")[2])) {
                    if (!string.split("&")[2].equals("vazio")) {
                        if (labelAutor.getText().length() != 0) {
                            labelAutor.setText(labelAutor.getText() + " ; " + string.split("&")[2]);
                        } else {
                            labelAutor.setText(string.split("&")[2]);
                        }

                    }
                }
            }
            if (labelPackage3.getText().length() != 0) {
                pesquisaMesmaPackage(labelPackage3.getText());
            }
            if (labelPackage3.getText().length() != 0) {
                pesquisaMaisDesteAutor(labelAutor.getText());
            }
        }
    }
}//GEN-LAST:event_listaResultadosValueChanged

private void listaResultadosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaResultadosMouseClicked
    if (evt.getClickCount() == 2) {
        try {
            if (caminhosResultados.size() != 0) {
                CodeWindow cw;
                StringBuilder readTextFile = files.readTextFile(caminhosResultados.get(listaResultados.getSelectedIndex()).split("%")[0]);
                String[] aux = ((String) listaResultados.getSelectedValue()).split("@");
                if (aux.length == 1) {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[0]);
                } else {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[1]);
                }
                cw.setVisible(true);
            }
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(this, "File no found!", "ERROR", JOptionPane.WARNING_MESSAGE);

        } catch (IOException ex) {
            JOptionPane.showMessageDialog(this, " ERROR opening file!", "ERROR", JOptionPane.ERROR_MESSAGE);
        }

    }
}//GEN-LAST:event_listaResultadosMouseClicked

private void jButtonPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesquisaActionPerformed
    System.out.println("SUBMIT");
    submetePesquisa(jTextFieldPesquisa.getText());
}//GEN-LAST:event_jButtonPesquisaActionPerformed

private void jMenuItemVarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemVarActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemVar.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemVarActionPerformed

private void jMenuItemDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDataActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemData.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemDataActionPerformed

private void jMenuItemMetodoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMetodoActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemMetodo.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemMetodoActionPerformed

private void jMenuItemAutorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAutorActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemAutor.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemAutorActionPerformed

private void jTextFieldPesquisaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldPesquisaKeyPressed
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        System.out.println("SUBMIT");
        submetePesquisa(jTextFieldPesquisa.getText());
        jPopupMenu1.setVisible(false);
        jPopupMenu1.setEnabled(false);
    }
}//GEN-LAST:event_jTextFieldPesquisaKeyPressed

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
    this.dispose();
    System.exit(0);
}//GEN-LAST:event_jMenuItem1ActionPerformed

private void jMenuItemNomeClasseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNomeClasseActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemNomeClasse.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemNomeClasseActionPerformed

private void jPopupMenu1MenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_jPopupMenu1MenuKeyPressed
    int c = evt.getKeyCode();
    MenuElement[] path;

    if (c == KeyEvent.VK_UP || c == KeyEvent.VK_DOWN) {
        path = jPopupMenu1.getSubElements();
        for (int i = 0; i <
                path.length; i++) {
            Component cc = path[i].getComponent();

            if (cc instanceof JMenuItem) {
                JMenuItem mi = (JMenuItem) cc;
                if (mi.isSelected()) {
                    String label = mi.getText();
                }
            }
        }
    }
}//GEN-LAST:event_jPopupMenu1MenuKeyPressed

private void jMenuItemNomeFichActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNomeFichActionPerformed
    jTextFieldPesquisa.setText("?" + jMenuItemNomeFich.getText() + " ");
    jPopupMenu1.setVisible(false);
}//GEN-LAST:event_jMenuItemNomeFichActionPerformed

private void jMenuItemDataStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemDataStateChanged
    mudaTextTipoPesquisa(jMenuItemData);
}//GEN-LAST:event_jMenuItemDataStateChanged

private void jMenuItemVarStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemVarStateChanged
    mudaTextTipoPesquisa(jMenuItemVar);

}//GEN-LAST:event_jMenuItemVarStateChanged

private void jMenuItemAutorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemAutorStateChanged
    mudaTextTipoPesquisa(jMenuItemAutor);
}//GEN-LAST:event_jMenuItemAutorStateChanged

private void jMenuItemMetodoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemMetodoStateChanged
    mudaTextTipoPesquisa(jMenuItemMetodo);
}//GEN-LAST:event_jMenuItemMetodoStateChanged

private void jMenuItemNomeClasseStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemNomeClasseStateChanged
    mudaTextTipoPesquisa(jMenuItemNomeClasse);
}//GEN-LAST:event_jMenuItemNomeClasseStateChanged

private void jMenuItemNomeFichStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jMenuItemNomeFichStateChanged
    mudaTextTipoPesquisa(jMenuItemNomeFich);
}//GEN-LAST:event_jMenuItemNomeFichStateChanged

private void butListaMetodosVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butListaMetodosVoltarActionPerformed
    painelListaMetodos.setVisible(false);
    painelListaMetodos.setEnabled(false);
    painelPrincipal.setVisible(true);
    painelPrincipal.setEnabled(true);
}//GEN-LAST:event_butListaMetodosVoltarActionPerformed

private void butVerMetodosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butVerMetodosActionPerformed

    labelTituloPainelMetodos.setText(labelFileSelected.getText());
    resetMethodsFields();
    listaMetodos.setListData(new Vector());
    painelPrincipal.setVisible(false);
    painelPrincipal.setEnabled(false);
    painelListaMetodos.setVisible(true);
    painelListaMetodos.setEnabled(true);
    if (idFileSelected.length() != 0) {
        pesquisaMetodosInFile(idFileSelected);
    }
}//GEN-LAST:event_butVerMetodosActionPerformed

private void listaMetodosValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listaMetodosValueChanged
    Vector<String> tmp;

    if (evt.getValueIsAdjusting() == false) {
        if (listaMetodos.getSelectedValue() != null) {
            textPaneMetParam.setText("");
            String idMetodo = idsMetodosInFile.get(listaMetodos.getSelectedIndex());
            tmp = queryEngine.getFileInfos(idMetodo, 2);

            for (String string : tmp) {
                if (!textPaneMetNome.getText().contains(string.split("&")[0])) {
                    textPaneMetNome.setText(string.split("&")[0]);
                }

                if (!textPaneMetDescricao.getText().contains(string.split("&")[1])) {
                    textPaneMetDescricao.setText(string.split("&")[1]);
                }
                if (!textPaneMetReturn.getText().contains(string.split("&")[2])) {
                    textPaneMetReturn.setText(string.split("&")[2]);
                }
                if (!textPaneMetParam.getText().contains(string.split("&")[3])) {
                    if (!string.split("&")[3].equals("vazio")) {
                        if (textPaneMetParam.getText().length() != 0) {
                            textPaneMetParam.setText(textPaneMetParam.getText() + " ; " + string.split("&")[3]);
                        } else {
                            textPaneMetParam.setText(string.split("&")[3]);
                        }
                    }
                }
                if (!textPaneMetDeprecated.getText().contains(string.split("&")[4])) {
                    textPaneMetDeprecated.setText(string.split("&")[4]);
                }
                if (!textPaneMetExcep.getText().contains(string.split("&")[5])) {
                    textPaneMetExcep.setText(string.split("&")[5]);
                }
            }
        }

    }
}//GEN-LAST:event_listaMetodosValueChanged

private void listaClassesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listaClassesValueChanged
    Vector<String> tmp;

    if (evt.getValueIsAdjusting() == false) {
        if (listaClasses.getSelectedValue() != null) {
            String idClasse = idsClassesInFile.get(listaClasses.getSelectedIndex());
            tmp = queryEngine.getFileInfos(idClasse, 1);
            for (String string : tmp) {
                if (!textPaneClasseNome.getText().contains(string.split("&")[0])) {
                    textPaneClasseNome.setText(string.split("&")[0]);
                }
                if (!textPaneClasseAutor.getText().contains(string.split("&")[1])) {
                    if (!string.split("&")[1].equals("vazio")) {
                        if (textPaneClasseAutor.getText().length() != 0) {
                            textPaneClasseAutor.setText(textPaneClasseAutor.getText() + " ; " + string.split("&")[1]);
                        } else {
                            textPaneClasseAutor.setText(string.split("&")[1]);
                        }
                    }
                }
                if (!textPaneClasseDescricao.getText().contains(string.split("&")[2])) {
                    textPaneClasseDescricao.setText(string.split("&")[2]);
                }
                if (!textPaneClasseDeprecated.getText().contains(string.split("&")[3])) {
                    textPaneClasseDeprecated.setText(string.split("&")[3]);
                }
                if (!textPaneClassePackage.getText().contains(string.split("&")[4])) {
                    textPaneClassePackage.setText(string.split("&")[4]);
                }
                if (!textPaneClassesExcep.getText().contains(string.split("&")[5])) {
                    textPaneClassesExcep.setText(string.split("&")[5]);
                }
                if (!textPaneClasseVersao.getText().contains(string.split("&")[6])) {
                    textPaneClasseVersao.setText(string.split("&")[6]);
                }
                if (!textPaneClasseVerTb.getText().contains(string.split("&")[7])) {
                    textPaneClasseVerTb.setText(string.split("&")[7]);
                }
                if (!textPaneClasseSince.getText().contains(string.split("&")[8])) {
                    textPaneClasseSince.setText(string.split("&")[8]);
                }
            }
        }

    }
}//GEN-LAST:event_listaClassesValueChanged

private void butListaMetodosVoltar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butListaMetodosVoltar1ActionPerformed
    painelListaClasses.setVisible(false);
    painelListaClasses.setEnabled(false);
    painelPrincipal.setVisible(true);
    painelPrincipal.setEnabled(true);
}//GEN-LAST:event_butListaMetodosVoltar1ActionPerformed

private void butVerClassesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butVerClassesActionPerformed
    labelTituloPainelClasses.setText(labelFileSelected.getText());
    listaClasses.setListData(new Vector());
    resetClassesFields();
    painelPrincipal.setVisible(false);
    painelPrincipal.setEnabled(false);
    painelListaClasses.setVisible(true);
    painelListaClasses.setEnabled(true);
    if (idFileSelected.length() != 0) {
        pesquisaClassesInFile(idFileSelected);
    }

}//GEN-LAST:event_butVerClassesActionPerformed

private void listaMaisDoAutorValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listaMaisDoAutorValueChanged
    Vector<String> tmp;
    DecimalFormat df = new DecimalFormat("0.0");
    if (evt.getValueIsAdjusting() == false) {
        if (listaMaisDoAutor.getSelectedValue() != null) {
            idFileSelected = caminhosMaisAutor.get(listaMaisDoAutor.getSelectedIndex()).split("%")[1];
            String str = (String) listaMaisDoAutor.getSelectedValue();
            int index = listaMaisDoAutor.getSelectedIndex();
            tmp = queryEngine.getFileInfos(caminhosMaisAutor.get(index).split("%")[1], 0);

            StringTokenizer tokenizer = new StringTokenizer(str);
            while (tokenizer.hasMoreTokens()) {
                str = tokenizer.nextToken();
            }
            String path = caminhosMaisAutor.get(index).split("%")[0];
            textFieldCaminho.setText(path);
            labelFileSelected.setText(str);
            labelTamanho.setText("");
            labelDataMod.setText("");
            labelPackage3.setText("");
            labelAutor.setText("");
            for (String string : tmp) {
                if (!labelTamanho.getText().contains(string.split("&")[0])) {
                    labelTamanho.setText(df.format(Double.parseDouble(string.split("&")[0]) / 1024) + " KB");
                }
                if (!labelDataMod.getText().contains(string.split("&")[1])) {
                    labelDataMod.setText(string.split("&")[1]);
                }
                if (!labelPackage3.getText().contains(string.split("&")[3])) {
                    labelPackage3.setText(string.split("&")[3]);
                }
                if (!labelAutor.getText().contains(string.split("&")[2])) {
                    if (!string.split("&")[2].equals("vazio")) {
                        if (labelAutor.getText().length() != 0) {
                            labelAutor.setText(labelAutor.getText() + " ; " + string.split("&")[2]);
                        } else {
                            labelAutor.setText(string.split("&")[2]);
                        }
                    }
                }
            }
        }
    }
}//GEN-LAST:event_listaMaisDoAutorValueChanged

private void listaMesmaPackageValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listaMesmaPackageValueChanged
    Vector<String> tmp;
    DecimalFormat df = new DecimalFormat("0.0");
    if (evt.getValueIsAdjusting() == false) {
        if (listaMesmaPackage.getSelectedValue() != null) {
            idFileSelected = caminhosMesmaPackage.get(listaMesmaPackage.getSelectedIndex()).split("%")[1];
            String str = (String) listaMesmaPackage.getSelectedValue();
            int index = listaMesmaPackage.getSelectedIndex();
            tmp = queryEngine.getFileInfos(caminhosMesmaPackage.get(index).split("%")[1], 0);

            StringTokenizer tokenizer = new StringTokenizer(str);
            while (tokenizer.hasMoreTokens()) {
                str = tokenizer.nextToken();
            }
            String path = caminhosMesmaPackage.get(index).split("%")[0];
            textFieldCaminho.setText(path);
            labelFileSelected.setText(str);
            labelTamanho.setText("");
            labelDataMod.setText("");
            labelPackage3.setText("");
            labelAutor.setText("");
            for (String string : tmp) {

                if (!labelTamanho.getText().contains(string.split("&")[0])) {
                    labelTamanho.setText(df.format(Double.parseDouble(string.split("&")[0]) / 1024) + " KB");
                }
                if (!labelDataMod.getText().contains(string.split("&")[1])) {
                    labelDataMod.setText(string.split("&")[1]);
                }
                if (!labelPackage3.getText().contains(string.split("&")[3])) {
                    labelPackage3.setText(string.split("&")[3]);
                }
                if (!labelAutor.getText().contains(string.split("&")[2])) {
                    if (!string.split("&")[2].equals("vazio")) {
                        if (labelAutor.getText().length() != 0) {
                            labelAutor.setText(labelAutor.getText() + " ; " + string.split("&")[2]);
                        } else {
                            labelAutor.setText(string.split("&")[2]);
                        }
                    }
                }
            }
        }
    }
}//GEN-LAST:event_listaMesmaPackageValueChanged

private void listaMaisDoAutorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaMaisDoAutorMouseClicked
    if (evt.getClickCount() == 2) {
        try {
            if (caminhosResultados.size() != 0) {
                CodeWindow cw;
                StringBuilder readTextFile = files.readTextFile(caminhosResultados.get(listaMaisDoAutor.getSelectedIndex()).split("%")[0]);
                String[] aux = ((String) listaMaisDoAutor.getSelectedValue()).split("@");
                if (aux.length == 1) {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[0]);
                } else {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[1]);
                }
                cw.setVisible(true);
            }
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(this, "File no found!", "ERROR", JOptionPane.WARNING_MESSAGE);

        } catch (IOException ex) {
            JOptionPane.showMessageDialog(this, " ERROR opening file!", "ERROR", JOptionPane.ERROR_MESSAGE);
        }

    }
}//GEN-LAST:event_listaMaisDoAutorMouseClicked

private void listaMesmaPackageMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaMesmaPackageMouseClicked
    if (evt.getClickCount() == 2) {
        try {
            if (caminhosMesmaPackage.size() != 0) {
                CodeWindow cw;
                StringBuilder readTextFile = files.readTextFile(caminhosMesmaPackage.get(listaMesmaPackage.getSelectedIndex()).split("%")[0]);
                String[] aux = ((String) listaMesmaPackage.getSelectedValue()).split("@");
                if (aux.length == 1) {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[0]);
                } else {
                    cw = new CodeWindow(this, readTextFile.toString(), aux[1]);
                }
                cw.setVisible(true);
            }
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(this, "File no found!", "ERROR", JOptionPane.WARNING_MESSAGE);

        } catch (IOException ex) {
            JOptionPane.showMessageDialog(this, " ERROR opening file!", "ERROR", JOptionPane.ERROR_MESSAGE);
        }

    }
}//GEN-LAST:event_listaMesmaPackageMouseClicked

private void butAbortarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butAbortarActionPerformed
    indexEngine.abortIndexing();
    butAbortar.setEnabled(false);

}//GEN-LAST:event_butAbortarActionPerformed

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
    JOptionPane.showMessageDialog(this, "Trabalho realizado no âmbito da cadeira de\n" +
            "Web Semântica no ano lectivo 2008/2009\n\n" +
            "Filipe Lourenço & Luis Rente", "Informações", JOptionPane.INFORMATION_MESSAGE);
}//GEN-LAST:event_jMenuItem2ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Tab1;
    private javax.swing.JPanel Tab2;
    private javax.swing.JLabel Versão;
    private javax.swing.JLabel Versão1;
    private javax.swing.JLabel Versão2;
    private javax.swing.JButton butAbortar;
    private javax.swing.JButton butListaMetodosVoltar;
    private javax.swing.JButton butListaMetodosVoltar1;
    private javax.swing.JButton butVerClasses;
    private javax.swing.JButton butVerMetodos;
    private javax.swing.JButton jButtonIndexGo;
    private javax.swing.JButton jButtonIndexProcura;
    private javax.swing.JButton jButtonPesquisa;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelMySQL;
    private javax.swing.JLabel jLabelPesquisa;
    private javax.swing.JLabel jLabelStatusIndex;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItemAutor;
    private javax.swing.JMenuItem jMenuItemData;
    private javax.swing.JMenuItem jMenuItemMetodo;
    private javax.swing.JMenuItem jMenuItemNomeClasse;
    private javax.swing.JMenuItem jMenuItemNomeFich;
    private javax.swing.JMenuItem jMenuItemVar;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane15;
    private javax.swing.JScrollPane jScrollPane16;
    private javax.swing.JScrollPane jScrollPane17;
    private javax.swing.JScrollPane jScrollPane18;
    private javax.swing.JScrollPane jScrollPane19;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane20;
    private javax.swing.JScrollPane jScrollPane21;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextFieldPathIndex;
    private javax.swing.JTextField jTextFieldPesquisa;
    private javax.swing.JLabel labelAutor;
    private javax.swing.JLabel labelDataMod;
    private javax.swing.JLabel labelFileSelected;
    private javax.swing.JLabel labelNumResults;
    private javax.swing.JLabel labelPackage3;
    private javax.swing.JLabel labelPercentagem;
    private javax.swing.JLabel labelTamanho;
    private javax.swing.JLabel labelTituloPainelClasses;
    private javax.swing.JLabel labelTituloPainelMetodos;
    private javax.swing.JLabel labelTituloPainelMetodos1;
    private javax.swing.JLabel labelTituloPainelMetodos3;
    private javax.swing.JList listaClasses;
    private javax.swing.JList listaMaisDoAutor;
    private javax.swing.JList listaMesmaPackage;
    private javax.swing.JList listaMetodos;
    private javax.swing.JList listaResultados;
    private javax.swing.JPanel painelListaClasses;
    private javax.swing.JPanel painelListaMetodos;
    private javax.swing.JPanel painelPrincipal;
    private javax.swing.JTextField textFieldCaminho;
    private javax.swing.JTextArea textOutIndex;
    private javax.swing.JTextPane textPaneClasseAutor;
    private javax.swing.JTextPane textPaneClasseDeprecated;
    private javax.swing.JTextPane textPaneClasseDescricao;
    private javax.swing.JTextPane textPaneClasseNome;
    private javax.swing.JTextPane textPaneClassePackage;
    private javax.swing.JTextPane textPaneClasseSince;
    private javax.swing.JTextPane textPaneClasseVerTb;
    private javax.swing.JTextPane textPaneClasseVersao;
    private javax.swing.JTextPane textPaneClassesExcep;
    private javax.swing.JTextPane textPaneMetDeprecated;
    private javax.swing.JTextPane textPaneMetDescricao;
    private javax.swing.JTextPane textPaneMetExcep;
    private javax.swing.JTextPane textPaneMetNome;
    private javax.swing.JTextPane textPaneMetParam;
    private javax.swing.JTextPane textPaneMetReturn;
    // End of variables declaration//GEN-END:variables
    private void submetePesquisa(String text) {
        if (text.trim().length() == 0) {
            JOptionPane.showMessageDialog(this, "Insira algum texto");
        } else if (text.trim().length() == 1) {
            JOptionPane.showMessageDialog(this, "Insira mais de um caracter", "Aviso", JOptionPane.WARNING_MESSAGE);
        } else {
            if (text.startsWith("?")) {
                StringTokenizer tokenizer = new StringTokenizer(text);
                if (tokenizer.countTokens() > 1) {
                    tokenizer.nextToken();
                    if (tokenizer.nextToken().trim().length() < 2) {
                        JOptionPane.showMessageDialog(this, "Insira mais de um caracter", "Aviso", JOptionPane.WARNING_MESSAGE);
                    } else {
                        trataResultadosPesquisa(0, queryEngine.interpretaInput(0, text.trim()));
                    }
                } else {
                    JOptionPane.showMessageDialog(this, "Tem que inserir um termo a pesquisar", "Aviso", JOptionPane.WARNING_MESSAGE);
                }
            } else {
                trataResultadosPesquisa(0, queryEngine.interpretaInput(0, text.trim()));
            }
        }
    }

    private void trataResultadosPesquisa(int type, Hashtable<String, Vector<String>> data) {
        Enumeration<String> e = data.keys();
        Vector<String> v = new Vector();
        Vector<String> keys = sortEnumeration(e);
        if (type == 0) {
            caminhosResultados.clear();
            for (String stringz : keys) {
                for (String string : data.get(stringz)) {
                    v.add(string.split("%")[0]);
                    caminhosResultados.add(string.split("%")[1] + "%" + string.split("%")[2]);
                }
            }
            v = removeDuplicatesCaminho(v);
            refreshListaResultados(v);
            int size = v.size();
            if (size == 0) {
                labelNumResults.setText("Nenhum resultado encontrado");
                idFileSelected = "";
                refreshListaMaisAutor(v);
                refreshListaMesmaPackage(v);
                refreshListaClasses(v);
                refreshListaMetodos(v);
                resetDetalhes();
            } else if (size == 1) {
                labelNumResults.setText("1 resultado encontrado");
            } else {
                labelNumResults.setText(caminhosResultados.size() + " resultados encontrados");
            }



        } else if (type == 1) {
            caminhosMaisAutor.clear();
            for (String stringz : keys) {
                for (String string : data.get(stringz)) {
                    v.add(string.split("%")[0]);
                    caminhosMaisAutor.add(string.split("%")[1] + "%" + string.split("%")[2]);
                }
            }
            refreshListaMaisAutor(removeDuplicatesCaminhoMaisAutor(v));
        } else if (type == 2) {
            caminhosMesmaPackage.clear();
            for (String stringz : keys) {
                for (String string : data.get(stringz)) {
                    v.add(string.split("%")[0]);
                    caminhosMesmaPackage.add(string.split("%")[1] + "%" + string.split("%")[2]);
                }
            }
            refreshListaMesmaPackage(removeDuplicatesMesmaPackage(v));
        } else if (type == 3) {
            //listar classes em ficheiro
            idsClassesInFile.clear();
            for (String stringz : keys) {
                for (String string : data.get(stringz)) {
                    v.add(string.split("%")[0]);
                    idsClassesInFile.add(string.split("%")[1]);
                }
            }
            refreshListaClasses(v);
        } else if (type == 4) {
            //listar metodos em ficheiro
            idsMetodosInFile.clear();
            for (String stringz : keys) {
                for (String string : data.get(stringz)) {
                    v.add(string.split("%")[0]);
                    idsMetodosInFile.add(string.split("%")[1]);
                }
            }
            refreshListaMetodos(v);
        }
    }
//    private void trataResultadosPesquisa(int type, Hashtable<String, Vector<String>> data) {
//        Enumeration<String> e = data.keys();
//        Vector<String> v = new Vector();
//        if (type == 0) {
//            caminhosResultados.clear();
//        } else if (type == 1) {
//            caminhosMaisAutor.clear();
//        } else if (type == 2) {
//            caminhosMesmaPackage.clear();
//        }
//        Vector<String> keys = sortEnumeration(e);
//
//        for (String stringz : keys) {
//            for (String string : data.get(stringz)) {
//                v.add(string.split("%")[0]);
//                if (type == 0) {
//                    caminhosResultados.add(string.split("%")[1] + "%" + string.split("%")[2]);
//
//                } else if (type == 1) {
//                    caminhosMaisAutor.add(string.split("%")[1] + "%" + string.split("%")[2]);
//
//                } else if (type == 2) {
//                    caminhosMesmaPackage.add(string.split("%")[1] + "%" + string.split("%")[2]);
//                }
//            }
//        }
//        if (type == 0) {
//            refreshListaResultados(removeDuplicatesCaminho(v));
//        } else if (type == 1) {
//            refreshListaMaisAutor(removeDuplicatesCaminhoMaisAutor(v));
//        } else if (type == 2) {
//            refreshListaMesmaPackage(removeDuplicatesMesmaPackage(v));
//
//        }
//    }
    private Vector<String> sortEnumeration(Enumeration<String> enu) {
        Vector<String> ret = new Vector<String>();
        while (enu.hasMoreElements()) {
            ret.add(enu.nextElement());
        }
        Collections.sort(ret);
        return ret;
    }

    private Vector removeDuplicatesCaminho(Vector v) {
        if (v != null) {
            Vector vNew = new Vector();
            Vector cNew = new Vector();
            for (int i = 0; i <
                    v.size(); i++) {
                if (!vNew.contains(v.get(i))) {
                    vNew.addElement(v.get(i));
                    cNew.addElement(caminhosResultados.get(i));
                }

            }
            caminhosResultados = cNew;
            return vNew;
        }

        return v;
    }

    private Vector removeDuplicatesCaminhoMaisAutor(Vector v) {
        if (v != null) {
            Vector vNew = new Vector();
            Vector cNew = new Vector();
            for (int i = 0; i <
                    v.size(); i++) {
                if (!vNew.contains(v.get(i))) {
                    vNew.addElement(v.get(i));
                    cNew.addElement(caminhosMaisAutor.get(i));
                }
            }
            caminhosMaisAutor = cNew;
            return vNew;
        }
        return v;
    }

    private Vector removeDuplicatesMesmaPackage(Vector v) {
        if (v != null) {
            Vector vNew = new Vector();
            Vector cNew = new Vector();
            for (int i = 0; i <
                    v.size(); i++) {
                if (!vNew.contains(v.get(i))) {
                    vNew.addElement(v.get(i));
                    cNew.addElement(caminhosMesmaPackage.get(i));
                }
            }
            caminhosMesmaPackage = cNew;
            return vNew;
        }
        return v;
    }

    private Vector removeDuplicates(Vector v) {
        if (v != null) {
            Vector vNew = new Vector();
            for (int i = 0; i <
                    v.size(); i++) {
                if (!vNew.contains(v.get(i))) {
                    vNew.addElement(v.get(i));
                }

            }
            return vNew;
        }

        return v;
    }

    public void setTextIndexOut(String txt) {
            textOutIndex.setText(textOutIndex.getText() + "\n" + txt);
            
            textOutIndex.setCaretPosition(textOutIndex.getDocument().getLength() - txt.length());
    }

    public void setPercentageLabel(String txt) {
        labelPercentagem.setText("Status: " + txt + "%");
    }
}
